# from django.http import HttpResponse
# from django.views.decorators.csrf import csrf_exempt
# from rest_framework import permissions
# from rest_framework.decorators import api_view, permission_classes
# from rest_framework.response import Response
# from rest_framework.utils import json
# from apitest.api import login, reserveopen, holdtime
# from apitest.debugtalk import get_hold_time, reserve_cancel_all
# from apitest.construct import get_environment, construct_parameter, construct_parameter_open, construct_parameter_holdtime
# from fct_rest_platform import settings
#
# cate_student=settings.cate_student
# cate_teacher=settings.cate_teacher
# area=settings.area
#
# @api_view(http_method_names=['post'])
# @permission_classes((permissions.AllowAny,))
# #学生预约课程场景
# def appoint_course(request):
#     parameter=request.data
#     uri=get_environment(parameter)#获取调用环境
#     #教师登陆
#     teach_param=construct_parameter(parameter,cate_teacher) #获取教师登录入参
#     teach_response=login(teach_param,uri) #老师登录
#     teach_data=json.loads(teach_response)
#     token_teacher=teach_data.get('data').get('token') #获取教师token
#     teaid=teach_data.get('data').get('mid') #获取教师id
#
#     #打开授课时间
#     open_param=construct_parameter_open(token_teacher,teaid)#获取打开授课时间入参
#     reserveopen(open_param,uri)
#
#     #学生登录
#     stu_param=construct_parameter(parameter,cate_student) #获取学生登录入参
#     stu_response=login(stu_param,uri)
#     stu_data=json.loads(stu_response)
#     token_student=stu_data.get('data').get('token')
#     uid=stu_data.get('data').get('mid')
#
#     # 取消已预约课程
#     reserve_cancel_all(token_student, cate_student, uid, uri)
#
#     #学生预约课程
#     hold_param=construct_parameter_holdtime(teaid,uid,token_student) #获取学生预约课程入参
#     hold_response=holdtime(hold_param,uri)
#     return Response(json.loads(hold_response))
